/**
 * 
 */
package info.niwota.group;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebView;

/**
 * @author qiangli
 * 
 */
public class Dialogs {
	private static final String HELP_URI = "file:///android_asset/help.html";

	/**
	 * 
	 */
	private Dialogs() {
	}
	
	public static Dialog createHelpDialog(final Context ctx) {
		LayoutInflater f = LayoutInflater.from(ctx);
		final View v = f.inflate(R.layout.webdia, null);
		WebView wv = (WebView) v.findViewById(R.id.webview);
		wv.loadUrl(HELP_URI);
		//
		AlertDialog.Builder b = new AlertDialog.Builder(ctx);

		b.setIcon(R.drawable.help);
		b.setTitle(R.string.menu_help);
		b.setView(v);

		return b.create();
	}

	public static Dialog createAttachDialog(final EtalkActivity ctx) {
		return new AlertDialog.Builder(ctx).setTitle(R.string.menu_attach)
				.setItems(R.array.attach_dialog_items,
						new DialogInterface.OnClickListener() {
							public void onClick(DialogInterface dialog,
									int which) {
								switch(which) {
								case 0:
									ctx.startAttachVideoActivity();
									break;
								case 1:
									ctx.startAttachPhotoActivity();
									break;
								}
							}
						}).create();
	}

}
